package my.study.java.basic.Enum;

public class EnumEx01 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		Size size1 = Enum.valueOf(Size.class, "SMALL");
		Size size2 = Size.MEDIUM;
		System.out.println(size2.ordinal());
		System.out.println(size2.compareTo(size1));
		for (Size s : Size.values()) {
			System.out.println(s);
		}
	}

}

enum Size {
	SMALL("S"), MEDIUM("M"), LARGE("L") {
		public String getS() {
			System.out.println("overwrite by LARGE");
			return "L";
		}
	},
	DEFAULT;
	private Size() {
		System.out.println("Size constructor()");
		this.s = "M";
	}

	private Size(String s) {
		System.out.println("Size constructor():" + s);
		this.s = s;
	}

	public String getS() {
		return s;
	}

	private String s;
}
